Realizing Monads in Interaction Nets via Generic Typed Rules
نویسندگان
چکیده
Interaction net systems are a model of computation based on graph rewriting. They enjoy various nice properties which make them a promising basis for a functional programming language. However, mechanisms to model impure functions are indispensable for a practical language. A natural approach to achieve this goal is the systematic use of monads. Yet, specifying the appropriate monads for impure language features is hard, due to the very restricted form of basic interaction rules. What is missing in particular, are appropriate means to specify higher-order functions and some typing mechanism that restricts computations to reasonable settings. In this paper, we propose two extensions of interaction nets which solve these problems. First we extend interaction rules with generic rules, thus adding a form of higher-order functions. Moreover, we define constraints on these rules to ensure the preservation of uniform confluence. In addition, we propose a simple type system in order to appropriately restrict the matching of generic rules. Finally, we show how the combination of these features, i.e., generic typed rules, can indeed be employed to model impure functions in interaction nets via monads in an intuitive and simple manner.
منابع مشابه
Realizing Impure Functions in Interaction Nets
We propose and illustrate first steps towards an extension of interaction nets based on monads to handle functions with side effects (e.g., I/O, exceptions). We define three monads for common types of side effects and show their correctness by proving the monad laws.
متن کاملExtending the Interaction Nets Calculus by Generic Rules
We extend the textual calculus for interaction nets by generic rules and propose constraints to preserve uniform confluence.
متن کاملInitial Semantics for higher-order typed syntax
We present an initial semantics result for typed higher-order syntax based on monads and modules over monads. The notion of module generalizes the substitution structure of monads. For a simply typed binding signature S we define a representation of S to be a monad equipped with a morphism of modules for each of its arities. The monad of abstract syntax of S then is the initial object in the ca...
متن کاملRelative Monads Formalised
Relative monads (Altenkirch, Chapman, and Uustalu 2010) are a recent generalisation of ordinary monads to cover similar structures where the underlying functor need not be an endofunctor. Our interest in this generalisation was triggered by some structures from programming theory that, in many ways, are strikingly similar to monads (even respecting the same laws), have similar programming appli...
متن کاملComonadic Notions of Computation
We argue that symmetric (semi)monoidal comonads provide a means to structure context-dependent notions of computation such as notions of dataflow computation (computation on streams) and of tree relabelling as in attribute evaluation. We propose a generic semantics for extensions of simply typed lambda calculus with context-dependent operations analogous to the Moggi-style semantics for effectf...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2012